package de.eventdroid.dao;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import de.eventdroid.R;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.net.ParseException;
import android.net.Uri;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

public class DatenbankSpecLocation extends ListActivity {
	
	private JSONArray jSONArray;
	private String resultString = null;
	private String meineListe = "";
	private TextView headline;
	private TextView location_type;
	private TextView location_address;
	private TextView location_city;	
	private int specLocID;
	private StringTokenizer locDataStrings;
	
	
	@Override
	public void onCreate(Bundle savedInstanceState) {		
		
		super.onCreate(savedInstanceState);
//		setContentView(R.layout.datenbank_special_location);

		/* Fetch assigned data of the special Location */
		meineListe = getIntent().getExtras().getString("location_data");		
		
		try{
			/* TextViews which have to be set */
//			headline = (TextView)findViewById(R.id.headline);
//			location_type = (TextView)findViewById(R.id.location_type);
//			location_address = (TextView)findViewById(R.id.location_address);
//			location_city = (TextView)findViewById(R.id.location_city);
			
			locDataStrings = new StringTokenizer(meineListe, "\n");
			
			/* Aufbereiten in Strings */
			// Surrounding by try catch if possibility of more than one or empty
		    	
		    headline.setText(locDataStrings.nextToken());
		    location_type.setText(locDataStrings.nextToken());
		    location_address.setText(locDataStrings.nextToken());
		    location_city.setText(locDataStrings.nextToken());

		} catch (ParseException e1) {
			Log.e("log_tag", "Parsing Exception: "+e1.toString());
		}
		
	}

}
